/*
 * Copyright (c) 2017, www.zm0618.com All Rights Reserved..
 */

package com.light.hessian.provider.config;

/**
 * Created by zhaojun on 2017/02/09.
 */
public class ProviderInfo {
    private String provider;
    private String protocol;
    private String serviceUrl;
    private boolean isShowBalancer;

    public String getProvider() {
        return provider;
    }

    public void setProvider(String provider) {
        this.provider = provider;
    }

    public String getProtocol() {
        return protocol;
    }

    public void setProtocol(String protocol) {
        this.protocol = protocol;
    }

    public String getServiceUrl() {
        return serviceUrl;
    }

    public void setServiceUrl(String serviceUrl) {
        this.serviceUrl = serviceUrl;
    }

    public boolean isShowBalancer() {
        return isShowBalancer;
    }

    public void setShowBalancer(boolean showBalancer) {
        isShowBalancer = showBalancer;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        ProviderInfo that = (ProviderInfo) o;

        if (isShowBalancer != that.isShowBalancer) return false;
        if (!provider.equals(that.provider)) return false;
        if (!protocol.equals(that.protocol)) return false;
        return serviceUrl.equals(that.serviceUrl);
    }

    @Override
    public int hashCode() {
        int result = provider.hashCode();
        result = 31 * result + protocol.hashCode();
        result = 31 * result + serviceUrl.hashCode();
        result = 31 * result + (isShowBalancer ? 1 : 0);
        return result;
    }
}
